Skip to content

fix: repeat copy-mode navigation keys - #2372

Open
ogulcancelik wants to merge 1 commit into
masterfrom
fix/copy-mode-arrow-repeat
Open

fix: repeat copy-mode navigation keys#2372
ogulcancelik wants to merge 1 commit into
masterfrom
fix/copy-mode-arrow-repeat

Conversation

@ogulcancelik

Copy link
Copy Markdown
Collaborator

Summary

  • repeat copy-mode arrow, Page Up/Down, Home, and End input when terminals report explicit repeat events
  • keep confirm, exit, prefix, and other modal actions single-shot
  • preserve input-source ownership with a copy-navigation-specific consumed lease

Reproduction

macOS Ghostty reports held arrows as Kitty Repeat events; Linux Ghostty reports repeated presses. Before this change, the macOS Ghostty → SSH path moved once. The patched build repeats continuously.

Tests

  • just check
  • automated macOS Ghostty → SSH validation: held Up changed copy-mode scroll offset from 0 to 53

Refs #2371

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

@ogulcancelik, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 31 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 0bd1a020-c93e-4b6f-9d73-4f64d0abc102

📥 Commits

Reviewing files that changed from the base of the PR and between 3638cce and 7cce478.

📒 Files selected for processing (4)
  • docs/next/CHANGELOG.md
  • src/app/input/copy_mode.rs
  • src/app/mod.rs
  • src/app/runtime.rs
📝 Walkthrough

Walkthrough

Copy-mode navigation now supports explicit terminal key-repeat events for arrows, Page Up/Down, Home, and End. Dedicated input leases route these events through copy-mode handling while preserving existing repeat behavior for other keys.

Changes

Copy-navigation repeat handling

Layer / File(s) Summary
Navigation repeat contract and test
src/app/input/copy_mode.rs
AppState permits repeats only for selected navigation keys in copy mode. The test validates repeated arrow movement and cursor clamping.
Repeat lease disposition
src/app/input/lease.rs
ConsumedInputLease records copy-navigation repeats. The lease table identifies these leases and excludes them from generic repeat planning.
Press and repeat event routing
src/app/mod.rs, src/app/runtime.rs, docs/next/CHANGELOG.md
Input routing records copy-navigation leases on key presses and replays repeat events while copy mode remains active. The changelog documents the supported keys.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Terminal
  participant AppState
  participant InputLeaseTable
  participant CopyModeHandler
  Terminal->>AppState: Send key press
  AppState->>InputLeaseTable: Record RepeatCopyNavigation
  Terminal->>AppState: Send KeyEventKind::Repeat
  AppState->>InputLeaseTable: Check copy-navigation lease
  AppState->>CopyModeHandler: Replay navigation repeat_count times
Loading

Possibly related issues

Possibly related PRs

  • herdrdev/herdr#2142 — Provides the input-lease repeat-routing system extended by this change.
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly and concisely describes the primary change: repeating navigation keys in copy mode.
Description check ✅ Passed The description directly explains the copy-mode repeat behavior, preserved single-shot actions, input lease handling, reproduction, and tests.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/copy-mode-arrow-repeat

Comment @coderabbitai help to get the list of available commands.

@kangal-bot kangal-bot added the ai-review Trigger automated AI reviews for pull requests admitted by the PR gate label Aug 5, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
src/app/input/copy_mode.rs (1)

1187-1199: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add coverage for both repeat routers.

This test exercises App::route_client_input, which covers the headless routing path. The PR also changes src/app/runtime.rs, and the allowlist includes PageUp, PageDown, Home, and End. Add one runtime-path test and cases for the remaining allowlisted keys.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e08b7c75-531f-4917-9e1a-26f5e9b923ae

📥 Commits

Reviewing files that changed from the base of the PR and between eb93ec8 and 3638cce.

📒 Files selected for processing (5)
  • docs/next/CHANGELOG.md
  • src/app/input/copy_mode.rs
  • src/app/input/lease.rs
  • src/app/mod.rs
  • src/app/runtime.rs

@ogulcancelik

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown
⚠️ Action not completed

Already reviewed.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@joonhwan

joonhwan commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Though I'm interested in this fix , when i cargo run this branch, copy mode's keys(i.e : j,k,ctrl-u,ctrl-d ...) cannot be repeated(For Windows herdr test).

@ogulcancelik
ogulcancelik force-pushed the fix/copy-mode-arrow-repeat branch from 3638cce to 7cce478 Compare August 9, 2026 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Trigger automated AI reviews for pull requests admitted by the PR gate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants